<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<script src="../static/angular.min.js"></script>
<head>
    <th:block th:include="include :: header('新增管理员')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<script>
    var app=angular.module("selectapp",[]);
    app.controller("selectcontroller",function ($scope,$http) {

    })
</script>
<body class="white-bg" ng-app="selectapp" ng-controller="selectcontroller">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-staff-add">



            <div class="form-group">    
                <label class="col-sm-3 control-label">登录姓名：</label>
                <div class="col-sm-8">
                    <input name="loginName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">登录密码：</label>
                <div class="col-sm-8">
                    <input name="loginPwd" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">角色类型：</label>
                <div class="col-sm-8">
                    <input name="staffName"  class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">部门</label>
                <select name="companyId" id="company">
                    <option value="">请选择</option>

                </select>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/tstaff"
        var prefixs = ctx + "system/dept"
        $("#form-staff-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-staff-add').serialize());
            }
        }

        $("input[name='startTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#company").ajax({
            type:"get",
            url: prefixs + "/list",
            dateType:"json",
            success:function (data) {
                alert(JSON.stringify(data));
                for (var i = 0; i < data.length; i++) {
                    var option = document.createElement("option");
                    $(option).val(data[i].deptId);
                    $(option).text(data[i].deptName);
                    $('#company').append(option);
                }

            }
        });

    </script>
</body>
</html>